package com.xdap.pg.exam.config;

import com.xdap.common.constant.DatasourceConstant;
import com.xdap.runtime.service.RuntimeAppContextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class ExamDatasource {

    @Autowired
    private RuntimeAppContextService runtimeAppContextService;

    private String schema;

    @PostConstruct
    public void setSchema(){
        this.schema=DatasourceConstant.XDAP_MYSQL_PREFIX + runtimeAppContextService.getCurrentTenantId();
    }

    public String getDataSource(){
        return this.schema;
    }
}
